package com.feicheng.iou.controller.common;

import com.feicheng.iou.commom.ReturnCode;
import com.feicheng.iou.entity.ReservationInterview;
import com.feicheng.iou.exception.SystemException;
import com.feicheng.iou.result.ResultInfo;
import com.feicheng.iou.service.ReservationInterviewService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wuweunan
 * @since 2021-06-28
 */
@RestController
@RequestMapping("/iou/common")
@Slf4j
public class ReservationInterviewCommonController {

    @Autowired
    private ReservationInterviewService reservationInterviewService; //预约接待实现类

    /**
     * @Author wuweinan
     * @Description 添加预约接待信息接口
     * @Date 2021-6-29 17:19
     * @param reservationInterview
     * @return ResultInfo
     */
    @PutMapping("/interview")
    public ResultInfo addInterviewTime(ReservationInterview reservationInterview) {
        log.info("ReservationInterviewCommonController的addInterviewTime进入");

        //参数是否为空校验
        if (reservationInterview == null) {
            throw new SystemException(ReturnCode.PARAM_NOT_NULL);
        }

        //插入一条预约接待信息
        log.info("ReservationInterviewCommonController的addInterviewTime返回");

        //根据学生的Id字段更新对应的预约回访时间
        return reservationInterviewService.updateInterviewReservationTime(reservationInterview);

    }

}
